package com.test.thread;

public class TwoThread {
    public synchronized void m1(){
        System.out.println("m1 start");
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("m1 end");
    }

    public /*synchronized*/ void m2(){
        System.out.println("m2 start");
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("m2 end");
    }

    public static void main(String[] args) {
        TwoThread t = new TwoThread();
        new Thread(t::m1).start();
        new Thread(t::m2).start();
    }
}
